package com.example.ginorva.tryeverything;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.example.ginorva.tryeverything.JPUSH.jpushactivity;
import com.example.ginorva.tryeverything.NDK.NDKActivity;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import gogrfun.push.R;

public class MainActivity extends AppCompatActivity {

    // Used to load the 'native-lib' library on application startup.
    static {
        System.loadLibrary("native-lib");
    }

    @BindView(R.id.trybaidumap)
    Button trybaidumap;
    @BindView(R.id.tryjpush)
    Button tryjpush;
    @BindView(R.id.trynuplyer)
    Button trynuplyer;
    @BindView(R.id.tryNDK)
    Button tryNDK;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        // Example of a call to a native method
       /* TextView tv = (TextView) findViewById(R.id.sample_text);
        tv.setText(stringFromJNI());*/
    }

    /**
     * A native method that is implemented by the 'native-lib' native library,
     * which is packaged with this application.
     */
    public native String stringFromJNI();

    @OnClick({R.id.trybaidumap, R.id.tryjpush, R.id.trynuplyer,R.id.tryNDK})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.trybaidumap:
                break;
            case R.id.tryjpush:
                ChangeToAnotherActivity(2);
                break;
            case R.id.trynuplyer:
                ChangeToAnotherActivity(3);
                break;
            case R.id.tryNDK:
                ChangeToAnotherActivity(4);
                break;
            default:
                break;
        }
    }

    public void ChangeToAnotherActivity(int i) {
        Log.d("TESTTAG", String.valueOf(i));
        Intent intent = new Intent();
        switch (i) {
            case 1:
                break;
            case 2:
                intent.setClass(MainActivity.this, jpushactivity.class);
                break;
            case 3:
            case 4:
                intent.setClass(MainActivity.this,NDKActivity.class);
                break;
            default:
                break;
        }
        this.startActivity(intent);
    }

}
